package com.woniuxy.dr_mall.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniuxy.dr_mall.entity.DrProducts;
import com.woniuxy.dr_mall.mapper.DrProductsMapper;
import com.woniuxy.dr_mall.service.IDrProductsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 张哲轩
 * @since 2021-08-11
 */
@Service
public class DrProductsServiceImpl extends ServiceImpl<DrProductsMapper, DrProducts> implements IDrProductsService {

    @Autowired
    private DrProductsMapper drProductsMapper;
    @Override
    public void add(DrProducts drProducts) {
        drProductsMapper.insert(drProducts);
    }

    @Override
    public DrProducts getProductById(int id) {
        return drProductsMapper.getProductById(id);
    }

    @Override
    public List<DrProducts> getByPopular(String popular) {
        return drProductsMapper.getByPopular(popular);
    }

    @Override
    public List<DrProducts> getByFavor(String favor) {
        return drProductsMapper.getByFavor(favor);
    }

    @Override
    public List<DrProducts> getByHot(String hot) {
        return drProductsMapper.getByHot(hot);
    }

    @Override
    public BigDecimal getMinPrice(Integer productId) {
        return drProductsMapper.getMinPrice(productId);
    }
}
